package com.hanagent.controller;

import java.io.File;

import com.hanagent.utils.ResponseUtils;
import com.hanagent.utils.StrUtils;
import com.jfinal.core.Controller;
import com.jfinal.upload.UploadFile;

public class UploadController extends Controller{
	
	public void uploadImg() {
		try {
            UploadFile file = getFile();
            System.out.println("--------file--------");
            File delfile = file.getFile();
            System.out.println("=========="+delfile.getPath());
            renderText(ResponseUtils.sendResult(1, StrUtils.getUploadPath() + delfile.getName(), "上传成功"));
        } catch (Exception e) {
            e.printStackTrace();
            renderText(ResponseUtils.sendResult(0, "", "上传失败"));
        }
	}

}
